package com.G_CN06.mvc.controller.F10.F101;

import com.G_CN06.commonUtil.commonResultConfig.CommonResult;
import com.G_CN06.mvc.entity.*;
import com.G_CN06.mvc.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author hcx
 * @className F101QuestionController
 * @description 出题模块
 * @since 2023/2/9 11:01
 **/
@RestController
@CrossOrigin
@RequestMapping("/question")
public class F1011QuestionController {
    @Autowired
    FillQuestionService fillQuestionService;
    @Autowired
    ChoiceQuestionService choiceQuestionService;
    @Autowired
    MultiChoiceQuestionService multiChoiceQuestionService;
    @Autowired
    JudgeQuestionService judgeQuestionService;
    @Autowired
    SubjectivityQuestionService subjectivityQuestionService;


    @PostMapping("/saveFillQuestion")
    public CommonResult saveFillQuestion(@RequestBody FillQuestion fillQuestion, HttpServletRequest request){
        return fillQuestionService.saveForTeacher(fillQuestion,request.getSession());
    }

    @PostMapping("/saveChoiceQuestion")
    public CommonResult saveChoiceQuestion(@RequestBody ChoiceQuestion choiceQuestion, HttpServletRequest request){
        return choiceQuestionService.saveForTeacher(choiceQuestion,request.getSession());
    }

    @PostMapping("/saveJudgeQuestion")
    public CommonResult saveJudgeQuestion(@RequestBody JudgeQuestion judgeQuestion, HttpServletRequest request){
        return judgeQuestionService.saveForTeacher(judgeQuestion,request.getSession());
    }

    @PostMapping("/saveMultiChoiceQuestion")
    public CommonResult saveMultiChoiceQuestion(@RequestBody MultiChoiceQuestion multiChoiceQuestion, HttpServletRequest request){
        return multiChoiceQuestionService.saveForTeacher(multiChoiceQuestion,request.getSession());
    }

    @PostMapping("/saveSubjectivityQuestion")
    public CommonResult saveSubjectivityQuestion(@RequestBody SubjectivityQuestion subjectivityQuestion, HttpServletRequest request){
        return subjectivityQuestionService.saveForTeacher(subjectivityQuestion,request.getSession());
    }


}
